package com.jiexin.controller;

import com.jiexin.common.JsonData;
import com.jiexin.param.WorkFlowParam;
import com.jiexin.param.WorkFlowStatusParam;
import com.jiexin.service.PlmWorkFlowStatusService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * @Author: Jay_Liu
 * @Description:
 * @Date: Created in 16:57 2018/5/19 0019
 * @Modified By:
 */
@Controller
@RequestMapping("/plm/workFlowStatus")
public class PlmWorkFlowStatusController {

    @Resource
    PlmWorkFlowStatusService plmWorkFlowStatusService;

    @RequestMapping("/save.json")
    @ResponseBody
    //保存
    public JsonData saveWorkFlowStatus(WorkFlowStatusParam param) {
        plmWorkFlowStatusService.save(param);
        return JsonData.success();
    }

    @RequestMapping("/update.json")
    @ResponseBody
    //更新
    public JsonData updateWorkFlowStatus(WorkFlowStatusParam param) {
        plmWorkFlowStatusService.update(param);
        return JsonData.success();
    }

    @RequestMapping("/delete.json")
    @ResponseBody
    //删除
    public JsonData deleteWorkFlowStatus(int workFlowStatusId) {
        plmWorkFlowStatusService.delete(workFlowStatusId);
        return JsonData.success();
    }

    @RequestMapping("/list.json")
    @ResponseBody
    //系统工作流数据
    public JsonData list(int workFlowId) {
        return JsonData.success(plmWorkFlowStatusService.getWorkFlowStatusByWorkFlowId(workFlowId));
    }
}
